<?php

$cfg = array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'language'=>'vi',

	'theme'=>'hoangngoc',

	// preloading 'log' component
	'preload'=>array(
		'log',
		'bootstrap'
	),

	'import'=>array(
		'application.models.*',
		'ext.common.registry.models.*',
		'application.components.*',
		'application.modules.user.models.*',
		'application.modules.user.components.*',
	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'1',
			'generatorPaths'=>array(
				'bootstrap.gii', // since 0.9.1
			),
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),

		'admin'=>array(
        	'class'=>'application.modules.admin.AdminModule',

            'modules'=>array(
				'user'=>array(
					'class'=>'ext.Hq.openIDUserModule.OpenIdUserModule',

					'roles'=>array('ADMIN', 'CONTENT_ADMIN'),

					'userComponentName'=>'hqUser',
				),
			),
		),

		'user'=>array(
        	'class'=>'application.modules.user.UserModule',
		),

		'hq' => array(
			'class' => 'application.modules.hq.HqModule',

			'preload'=>array(
				'bootstrap'
			),

			'controllerMap'=>array(
				'registry'=>'ext.common.registry.controllers.RegistryController',

				'yiiLog'=>array(
					'class'=>'ext.common.YiiLogViewerController.YiiLogViewerController',
				),
			),

			'modules'=>array(
				'user'=>array(
					'class'=>'ext.Hq.openIDUserModule.OpenIdUserModule',

					'roles'=>array('ADMIN', 'EDIT_ADMIN'),

					'userComponentName'=>'hqUser',
				),
			),

			'components'=>array(
				'bootstrap'=>array(
					'class'=>'ext.common.bootstrap.components.Bootstrap',
					'responsiveCss'=>true,
					'yiiCss'=>true,
				),
			),
		),

		'hqUser'=>array(
			'class'=>'ext.Hq.openIDUserModule.OpenIdUserModule',

			'preload'=>array(
				'bootstrap'
			),

			'roles'=>array('ADMIN', 'EDIT_ADMIN'),

			'userComponentName'=>'hqUser',

			'components'=>array(
				'bootstrap'=>array(
					'class'=>'ext.common.bootstrap.components.Bootstrap',
					'responsiveCss'=>true,
					'yiiCss'=>true,
				),
			),
		),
	),

	'controllerMap'=>array(
		'YiiFeedWidget' => 'ext.yii-feed-widget.YiiFeedWidgetController',
	),

	// application components
	'components'=>array(
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),

		// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			'class' => 'ext.common.BKUrlManager',
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'rules'=>array(
				'<_c:\w+>/' => '<_c>/',
				'<_c:\w+>/<_a:\w+>' => '<_c>/<_a>',
				'<_m:\w+>/<_c:\w+>/<_a:\w+>' => '<_m>/<_c>/<_a>',
				'<_p1:\w+>/<_p2:\w+>/<_p3:\w+>/<_p4:\w+>' => '<_p1>/<_p2>/<_p3>/<_p4>',
			),
		),

		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CDbLogRoute',

					'logTableName'=>'yii_log',
					'connectionID'=>'db',
					'levels'=>'error, warning',
				),
				array(
					'class'=>'CProfileLogRoute',
				),
			),
		),

		'image' => array(
			'class' => 'ext.image.CImageComponent',
			// GD or ImageMagick
			'driver' => 'GD',
			// ImageMagick setup path
			'params' => array('directory' => '/opt/local/bin'),
		),

		'hqUser'=>array(
			'class'=>'ext.Hq.HqUserComponent',
			'allowAutoLogin'=>true,
			'loginUrl'=>array('/hqUser/signIn'),
		),

		'user' => array(
			// enable cookie-based authentication
			'allowAutoLogin' => true,
			'loginUrl' => array('/user/login'),
		),

		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=s_gaohoangngoc',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
			'schemaCachingDuration'=>3600,
		),

		'registry'=>array(
			'class'=>'ext.common.registry.registryComponent',
		),

		'bootstrap'=>array(
			'class'=>'ext.common.bootstrap.components.Bootstrap',
			'responsiveCss'=>false,
			'enableJS'=>false,
			'yiiCss'=>false,
			'coreCss'=>false,
		),
	),

	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
	),
);

//$cfg = CMap::mergeArray(
//	require dirname(__FILE__).DIRECTORY_SEPARATOR.'module.php',
//	$cfg
//);

return $cfg;